package top.songxs.gmall.web.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;
import top.songxs.gmall.cart.vo.UserAuthInfoVo;
import top.songxs.gmall.common.util.UserAuthUtil;

@Component
public class FeignRequestInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        UserAuthInfoVo userAuthInfo = UserAuthUtil.getUserAuthInfo();
        String userId = userAuthInfo.getUserId();
        String userTempId = userAuthInfo.getUserTempId();
        requestTemplate.header("userId", userId);
        requestTemplate.header("userTempId", userTempId);

    }


}
